// vite.config.ts
import {fileURLToPath, URL} from 'node:url'
import {defineConfig} from 'vite'
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import {ElementPlusResolver} from 'unplugin-vue-components/resolvers'
import vue from '@vitejs/plugin-vue'
import vueDevTools from 'vite-plugin-vue-devtools'

export default defineConfig({
    plugins: [
        AutoImport({
            resolvers: [ElementPlusResolver()],
        }),
        Components({
            resolvers: [ElementPlusResolver()],
        }),
        vue(),
        vueDevTools(),
    ],
    resolve: {
        alias: {
            '@': fileURLToPath(new URL('./src', import.meta.url))
        },
    },
    //将端口号更改为8080
    server: {
        host: '0.0.0.0',  // ip 地址,全是0为保留ip,可以代替任何ip地址
        port: 8080, // 设置前端工程服务的端口号
        open: false  // 是否自动打开浏览器
    }
});




